package com.ruoyi.fun.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.fun.mapper.EcBrandMapper;
import com.ruoyi.fun.domain.EcBrand;
import com.ruoyi.fun.service.IEcBrandService;

/**
 * 品牌Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-06
 */
@Service
public class EcBrandServiceImpl implements IEcBrandService 
{
    @Autowired
    private EcBrandMapper ecBrandMapper;

    /**
     * 查询品牌
     * 
     * @param brandId 品牌主键
     * @return 品牌
     */
    @Override
    public EcBrand selectEcBrandByBrandId(Long brandId)
    {
        return ecBrandMapper.selectEcBrandByBrandId(brandId);
    }

    /**
     * 查询品牌列表
     * 
     * @param ecBrand 品牌
     * @return 品牌
     */
    @Override
    public List<EcBrand> selectEcBrandList(EcBrand ecBrand)
    {
        return ecBrandMapper.selectEcBrandList(ecBrand);
    }

    /**
     * 新增品牌
     * 
     * @param ecBrand 品牌
     * @return 结果
     */
    @Override
    public int insertEcBrand(EcBrand ecBrand)
    {
        ecBrand.setCreateTime(DateUtils.getNowDate());
        ecBrand.setOrgId(SecurityUtils.getDeptId());
        return ecBrandMapper.insertEcBrand(ecBrand);
    }

    /**
     * 修改品牌
     * 
     * @param ecBrand 品牌
     * @return 结果
     */
    @Override
    public int updateEcBrand(EcBrand ecBrand)
    {
        ecBrand.setUpdateTime(DateUtils.getNowDate());
        return ecBrandMapper.updateEcBrand(ecBrand);
    }

    /**
     * 批量删除品牌
     * 
     * @param brandIds 需要删除的品牌主键
     * @return 结果
     */
    @Override
    public int deleteEcBrandByBrandIds(Long[] brandIds)
    {
        return ecBrandMapper.deleteEcBrandByBrandIds(brandIds);
    }

    /**
     * 删除品牌信息
     * 
     * @param brandId 品牌主键
     * @return 结果
     */
    @Override
    public int deleteEcBrandByBrandId(Long brandId)
    {
        return ecBrandMapper.deleteEcBrandByBrandId(brandId);
    }

    /**
     * 根据brandId和组织ID查询Brand
     * 
     * @param brandId Brand主键
     * @param orgId 组织ID
     * @return Brand
     */
    @Override
    public EcBrand selectEcBrandByBrandIdAndOrgId(Long brandId, Long orgId)
    {
        return ecBrandMapper.selectEcBrandByBrandIdAndOrgId(brandId, orgId);
    }

    /**
     * 根据组织ID查询Brand列表
     * 
     * @param ecbrand Brand
     * @param orgId 组织ID
     * @return Brand集合
     */
    @Override
    public List<EcBrand> selectEcBrandListByOrgId(EcBrand ecbrand, Long orgId)
    {
        return ecBrandMapper.selectEcBrandListByOrgId(ecbrand, orgId);
    }
}
